#ifndef CUBE_CORE_H_
#define CUBE_CORE_H_

//LRESULT CALLBACK MsgProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );

class GameState;
class ActorManager;
class AssetManager;
class SceneManager;

#ifdef _DEBUG
class DebugDialog;
#endif

class Core
{
friend LRESULT CALLBACK MsgProc( HWND, UINT, WPARAM, LPARAM );

public :
	static Core&			GetInstance();
	//static ActorManager&	GetActorManager();
	//static AssetManager&	GetAssetManager();
	static SceneManager&	GetSceneManager();

	int						GetClientSizeX(){ return _clientSizeX; }
	int						GetClientSizeY(){ return _clientSizeY; }
	LPDIRECT3D9				GetD3d(){ return _pD3d; }
	LPDIRECT3DDEVICE9		GetD3dDevice(){ return _pD3dDevice; }
	HINSTANCE				GetInstanceHandle(){ return _hInstance; }
	HWND					GetWindowHandle(){ return _hMainWnd; }
	
	void					SetD3dDevice( LPDIRECT3DDEVICE9* ppDevice ){ _pD3dDevice = *ppDevice; }

	bool					Initialize( HINSTANCE hInst );
	void					PrepareToQuit(){ _isStillPlaying = false; }
	void					Release();
	int						Run();

#ifdef _DEBUG
	DebugDialog*			GetDebugDialog(){ return _pDbgDlg; }
	GameState*				GetGameState(){ return _pState; }
#endif
	
private :
	Core();
	~Core();

	static Core*			_pCore;

	// Managers
	ActorManager*			_pActorMgr;
	AssetManager*			_pAssetMgr;
	SceneManager*			_pSceneMgr;

	int						_clientSizeX;
	int						_clientSizeY;
	LPDIRECT3D9				_pD3d;
	LPDIRECT3DDEVICE9		_pD3dDevice;
	HINSTANCE				_hInstance;
	HWND					_hMainWnd;
	bool					_isInitialized;
	bool					_isStillPlaying;
	GameState*				_pState;

#ifdef _DEBUG
	DebugDialog*			_pDbgDlg;
#endif
};

#endif